import GameUI from "../UIs/GameUI";
import MainUI from "../UIs/MainUI";

export default class AndroidTool{

    static ShowAD(ADEnum:ADEnum){
        if (cc.sys.platform == cc.sys.ANDROID) {
            jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", ADEnum, "()V");
        }
        if(ADEnum == "GameVideo1"){
            cc.playVideoSuccess1 = function () {
                MainUI.Instance.onUnlockReward();
            }
        }
        else if(ADEnum == "GameVideo2"){
            cc.playVideoSuccess2 = function () {
                GameUI.Instance.AnswerReward();
            }
        }
        else if(ADEnum == "GameVideo3"){
            cc.playVideoSuccess3 = function () {
                GameUI.Instance.NextReward();
            }
        }
        else console.error(ADEnum + "," + "参数错误");
    }
}

export enum ADEnum {
    None = 'None',
    ChaPing = 'ChaPing',
    Exit = 'Exit',
    KeFu ='KeFu',
    YinSi='Hide',
    MoreGame='MoreGame',
    GameVideo1 = "GameVideo1",
    GameVideo2 = "GameVideo2",
    GameVideo3 = "GameVideo3"
}